/* tcph2net.c - tcph2net */

#include "tcp.h"
#include <netinet/in.h>

/*------------------------------------------------------------------------
 *  tcph2net -  convert TCP header fields from host to net byte order
 *------------------------------------------------------------------------
 */
struct tcp * tcph2net(struct tcp *ptcp)
{
	// NOTE: does not include TCP options

         unsigned short  sport = ptcp->tcp_sport;
         unsigned short  dport = ptcp->tcp_dport;
         unsigned short  window = ptcp->tcp_window;
         unsigned short  urgptr = ptcp->tcp_urgptr;

         tcpseq seq = ptcp->tcp_seq;
         tcpseq ack = ptcp->tcp_ack;


	ptcp->tcp_sport = htons(sport);
	ptcp->tcp_dport = htons(dport);
	ptcp->tcp_seq = htonl(seq);
	ptcp->tcp_ack = htonl(ack);
	ptcp->tcp_window = htons(window);
	ptcp->tcp_urgptr = htons(urgptr);
         
	return ptcp;
}
